function ParamsUtil() {}

ParamsUtil.excludeNull = function(params, isPrint) {
  let data = new Object();
  Object.keys(params).forEach((key) => {
    if (params[key] != "" && params[key] != null) {
      if (isPrint) {
        console.log("paramIn", key, params[key]);
      }
      data[key] = params[key];
    } else {
      if (isPrint) {
        console.log("paramOut", key, params[key]);
      }
    }
  });
  return data;
};

ParamsUtil.convertToFormData = function(params, isPrint) {
    let formData = new FormData();
    Object.keys(params).forEach((key) => {
      if (params[key] != "" && params[key] != null) {
        if (isPrint) {
          console.log("paramIn", key, params[key]);
        }
        data.append(key, params[key]);
      } else {
        if (isPrint) {
          console.log("paramOut", key, params[key]);
        }
      }
    });
    return formData;
  };

export default ParamsUtil;
